home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form frmMain
- BorderStyle = 1 'Fixed Single
- Caption = "PC Alarm"
- ClientHeight = 4860
- ClientLeft = 45
- ClientTop = 615
- ClientWidth = 6975
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4860
- ScaleWidth = 6975
- StartUpPosition = 1 'CenterOwner
- Begin VB.PictureBox Picture1
- BackColor = &H00FFFFFF&
- FillColor = &H00FFFFFF&
- ForeColor = &H00FFFFFF&
- Height = 375
- Left = 120
- ScaleHeight = 315
- ScaleWidth = 1620
- TabIndex = 8
- Top = 4275
- Width = 1680
- Begin MSComCtl2.UpDown UpDown1
- Height = 330
- Left = 1425
- TabIndex = 13
- Top = 0
- Width = 195
- _ExtentX = 344
- _ExtentY = 582
- _Version = 393216
- Enabled = -1 'True
- End
- Begin VB.TextBox txtAmPm
- Alignment = 2 'Center
- BorderStyle = 0 'None
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 450
- Left = 885
- Locked = -1 'True
- TabIndex = 12
- Text = "AM"
- Top = 0
- Width = 450
- End
- Begin VB.TextBox txtMinute
- Alignment = 2 'Center
- BorderStyle = 0 'None
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 450
- Left = 480
- TabIndex = 11
- Text = "59"
- Top = 0
- Width = 345
- End
- Begin VB.TextBox txtHour
- Alignment = 2 'Center
- BorderStyle = 0 'None
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 450
- Left = 0
- TabIndex = 9
- Text = "12"
- Top = 0
- Width = 345
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- BackColor = &H00FFFFFF&
- Caption = ":"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 330
- Left = 345
- TabIndex = 10
- Top = -15
- Width = 135
- End
- End
- Begin MSComDlg.CommonDialog CDB
- Left = 2025
- Top = 4095
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 2010
- Top = 3420
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 7
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":0000
- Key = ""
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":0454
- Key = ""
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":08A8
- Key = ""
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":0D04
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":1020
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":1474
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "FormMain.frx":1790
- Key = ""
- EndProperty
- EndProperty
- End
- Begin VB.Timer Timer1
- Interval = 200
- Left = 2070
- Top = 2865
- End
- Begin VB.Frame Frame1
- Height = 4695
- Left = 1890
- TabIndex = 3
- Top = 45
- Width = 4920
- Begin VB.TextBox txtMessage
- Height = 1560
- Left = 195
- TabIndex = 18
- Text = "Type your message here."
- Top = 1050
- Width = 4515
- End
- Begin VB.CommandButton cmdBackColor
- Caption = "Change Back Color"
- Height = 585
- Left = 2760
- TabIndex = 17
- Top = 2925
- Width = 1215
- End
- Begin VB.CommandButton cmdActivate
- Caption = "Activate Alarm"
- Height = 585
- Left = 825
- TabIndex = 16
- Top = 3795
- Width = 1215
- End
- Begin VB.CommandButton cmdFont
- Caption = "Change Font"
- Height = 585
- Left = 825
- TabIndex = 15
- Top = 2925
- Width = 1215
- End
- Begin VB.CommandButton cmdCancel
- Caption = "Cancel"
- Height = 585
- Left = 2760
- TabIndex = 7
- Top = 3795
- Width = 1215
- End
- Begin VB.Label lblMsg
- BackColor = &H80000009&
- BorderStyle = 1 'Fixed Single
- Enabled = 0 'False
- Height = 1560
- Left = 195
- TabIndex = 6
- Top = 1050
- Width = 4515
- WordWrap = -1 'True
- End
- Begin VB.Label lblCurrent
- BorderStyle = 1 'Fixed Single
- Caption = "No current action defined"
- Height = 285
- Left = 195
- TabIndex = 5
- Top = 510
- Width = 4515
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "Current Action"
- Height = 195
- Left = 180
- TabIndex = 4
- Top = 240
- Width = 1005
- End
- End
- Begin VB.CommandButton cmdMessage
- Caption = "Message"
- Height = 945
- Left = 330
- Style = 1 'Graphical
- TabIndex = 2
- Tag = "Message"
- Top = 2535
- Width = 1215
- End
- Begin VB.CommandButton cmdSound
- Caption = "Sound"
- Height = 945
- Left = 345
- Style = 1 'Graphical
- TabIndex = 1
- Tag = "Sound"
- Top = 1335
- Width = 1200
- End
- Begin VB.CommandButton cmdProgram
- Caption = "Program"
- Height = 945
- Left = 330
- Style = 1 'Graphical
- TabIndex = 0
- Tag = "Program"
- Top = 135
- Width = 1215
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Caption = "Set Time"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 375
- TabIndex = 14
- Top = 3795
- Width = 1125
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileProgram
- Caption = "Set &Program"
- End
- Begin VB.Menu mnuFileSound
- Caption = "Set &Sound"
- End
- Begin VB.Menu mnuFileMessage
- Caption = "Set &Message"
- End
- Begin VB.Menu mnuFileSep
- Caption = "-"
- End
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Begin VB.Menu mnuAbout
- Caption = "&About"
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim hour As Boolean
- Dim min As Boolean
- Dim ampm As Boolean
- Private Sub Command1_Click()
- ' fmainform is defined in the module
- fMainForm.WindowState = 1
- Load frmMessage
- Call SetUpForm(frmMessage)
- frmMessage.Show
- End Sub
- Private Sub Form_Load()
- ' set all the icons on the command buttons
- cmdProgram.Picture = ImageList1.ListImages(1).Picture
- cmdProgram.DisabledPicture = ImageList1.ListImages(4).Picture
- cmdMessage.Picture = ImageList1.ListImages(2).Picture
- cmdMessage.DisabledPicture = ImageList1.ListImages(5).Picture
- cmdSound.Picture = ImageList1.ListImages(3).Picture
- cmdSound.DisabledPicture = ImageList1.ListImages(6).Picture
- ' set the forms icon
- frmMain.Icon = ImageList1.ListImages(7).Picture
-
- ' disable the timer
- Timer1.Enabled = False
- Call SetDefaults
- End Sub
- Private Sub cmdProgram_Click()
- ' process the cancel button
- ' this forces an error if the user presses the cancel button
- CDB.CancelError = True
- On Error GoTo ErrHandler
- ' clear the the filename
- CDB.FileName = ""
- ' set filters
- CDB.Filter = "Program Files (*.exe)|*.exe"
- ' display the dialog box
- CDB.ShowOpen
- ' show the selection in current action label
- lblCurrent.Caption = "Run Program"
- lblMsg.Visible = True
- txtMessage.Visible = False
- lblMsg.Caption = CDB.FileName
- cmdSound.Enabled = False
- cmdMessage.Enabled = False
- cmdCancel.Enabled = True
- cmdActivate.Enabled = True
- ' use the command buttons tag
- index = cmdProgram.Tag
- ' exit the sub here if user pressed ok
- Exit Sub
-
- ErrHandler:
- Call SetDefaults
- Exit Sub
- End Sub
- Private Sub cmdSound_Click()
- CDB.CancelError = True
- On Error GoTo ErrHandler
- CDB.FileName = ""
- CDB.Filter = "Wav Files (*.wav)|*.wav"
- CDB.ShowOpen
- lblCurrent.Caption = "Play Sound"
- lblMsg.Visible = True
- txtMessage.Visible = False
- lblMsg.Caption = CDB.FileName
- cmdProgram.Enabled = False
- cmdMessage.Enabled = False
- cmdCancel.Enabled = True
- cmdActivate.Enabled = True
- index = cmdSound.Tag
- Exit Sub
- ErrHandler:
- Call SetDefaults
- Exit Sub
- End Sub
- Private Sub cmdMessage_Click()
-
- txtMessage.Visible = True
- txtMessage.SetFocus
- txtMessage.SelStart = 0
- txtMessage.SelLength = txtMessage.Width
-
- lblMsg.Visible = False
- lblCurrent.Caption = "Display custom message"
- cmdFont.Enabled = True
- cmdBackColor.Enabled = True
- cmdProgram.Enabled = False
- cmdSound.Enabled = False
- cmdCancel.Enabled = True
- cmdActivate.Enabled = True
- index = cmdMessage.Tag
- End Sub
- Private Sub cmdFont_Click()
- ' **** NOTE ****
- ' since i am using a 'textbox' the font size of 72 doesn't show up
- ' i could have used another control ... but on my system i never use
- ' a font that big anyways :)
- CDB.CancelError = True
- On Error GoTo ErrHandler
- CDB.Flags = cdlCFBoth Or cdlCFEffects
- CDB.ShowFont
- 'update the label box to the users selections
- txtMessage.Font.Size = CDB.FontSize
- txtMessage.Font.Bold = CDB.FontBold
- txtMessage.Font.Italic = CDB.FontItalic
- txtMessage.Font.Underline = CDB.FontUnderline
- txtMessage.Font.Strikethrough = CDB.FontStrikethru
- Exit Sub
- ErrHandler:
- Exit Sub
- End Sub
- Private Sub cmdBackColor_Click()
- CDB.CancelError = True
- On Error GoTo ErrHandler
- CDB.Flags = cdlCCFullOpen
- CDB.ShowColor
- ' change the label to the users selection
- txtMessage.BackColor = CDB.Color
- Exit Sub
- ErrHandler:
- Exit Sub
- End Sub
- Private Sub cmdActivate_Click()
- fMainForm.WindowState = 1
- Timer1.Enabled = True
- Call Timer1_Timer
- End Sub
- Private Sub cmdCancel_Click()
- Call SetDefaults
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- End
- End Sub
- Private Sub mnuFileProgram_Click()
- Call cmdProgram_Click
- End Sub
- Private Sub mnuFileSound_Click()
- Call cmdSound_Click
- End Sub
- Private Sub mnuFileMessage_Click()
- Call cmdMessage_Click
- End Sub
- Private Sub mnuFileExit_Click()
- End
- End Sub
- Private Sub mnuAbout_Click()
- Dim msg As String
- msg = "PC Alarm" & vbCrLf & _
- "Written by John Meller" & vbCrLf & _
- "Questions, suggestions or comments" & vbCrLf & _
- "e-mail me at jmeller@istar.ca"
-
- MsgBox msg, vbInformation + vbOKOnly, "PC Alarm: About"
-
- End Sub
- Private Sub SetDefaults()
- ' set up the lblmsg with all the defaults
- With lblMsg
- .Caption = ""
- .BackColor = vbWhite
- .Visible = True
- .Font = "MS Sans Serif"
- .FontBold = False
- .FontItalic = False
- .FontSize = 8
- .FontStrikethru = False
- .FontUnderline = False
- .ForeColor = vbBlack
- End With
- lblCurrent.Caption = "No current action defined."
- 'disable the uneeded buttons
- cmdFont.Enabled = False
- cmdBackColor.Enabled = False
- cmdActivate.Enabled = False
- cmdCancel.Enabled = False
- ' disable the textbox
- txtMessage.Visible = False
- ' and enable the needed buttons
- cmdProgram.Enabled = True
- cmdSound.Enabled = True
- cmdMessage.Enabled = True
-
- End Sub
- Private Sub Timer1_Timer()
- Dim strTemp As String
- Dim strSetTime As String
- Dim strTime As String
- strTemp = txtHour.Text & ":" & txtMinute.Text & txtAmPm.Text
- strSetTime = Format(strTemp, "hh:nn AM/PM")
- strTime = Format(Time, "hh:nn AM/PM")
- If strSetTime = strTime Then
- Call ActivateAlarm(index)
- Exit Sub
- End If
- End Sub
- Private Sub txtAmPm_Click()
- txtAmPm.SelStart = 0
- txtAmPm.SelLength = txtAmPm.Width
- hour = False
- min = False
- ampm = True
- End Sub
- Private Sub txtHour_Click()
- txtHour.SelStart = 0
- txtHour.SelLength = txtHour.Width
- hour = True
- min = False
- ampm = False
- End Sub
- Private Sub txtminute_Click()
- txtMinute.SelStart = 0
- txtMinute.SelLength = txtMinute.Width
- hour = False
- min = True
- ampm = False
- End Sub
- Private Sub UpDown1_DownClick()
- If hour = True Then
- With UpDown1
- .min = 1
- .Max = 12
- .Increment = 1
- .Wrap = True
- End With
- If UpDown1.Value <= 9 Then
- 'put a leading 0 in front
- txtHour.Text = "0" & UpDown1.Value
- Else
- txtHour.Text = UpDown1.Value
- End If
- End If
- If min = True Then
- With UpDown1
- .min = 0
- .Max = 59
- .Increment = 1
- .Wrap = True
- End With
-
- If UpDown1.Value <= 9 Then
- txtMinute.Text = "0" & UpDown1.Value
- Else
- txtMinute.Text = UpDown1.Value
- End If
-
- End If
- If ampm = True Then
- With UpDown1
- .min = 1
- .Max = 2
- .Increment = 1
- .Wrap = True
- End With
-
- If UpDown1.Value = 1 Then
- txtAmPm.Text = "AM"
- Else
- txtAmPm.Text = "PM"
- End If
- End If
-
- End Sub
- Private Sub UpDown1_UpClick()
- If hour = True Then
- With UpDown1
- .min = 1
- .Max = 12
- .Increment = 1
- .Wrap = True
- End With
- If UpDown1.Value <= 9 Then
- txtHour.Text = "0" & UpDown1.Value
- Else
- txtHour.Text = UpDown1.Value
- End If
- End If
- If min = True Then
- With UpDown1
- .min = 0
- .Max = 59
- .Increment = 1
- .Wrap = True
- End With
- If UpDown1.Value <= 9 Then
- txtMinute.Text = "0" & UpDown1.Value
- Else
- txtMinute.Text = UpDown1.Value
- End If
- End If
- If ampm = True Then
- With UpDown1
- .min = 1
- .Max = 2
- .Increment = 1
- .Wrap = True
- End With
-
- If UpDown1.Value = 1 Then
- txtAmPm.Text = "AM"
- Else
- txtAmPm.Text = "PM"
- End If
- End If
-
- End Sub
-